from lib.webui import  *
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from hyrobot.common import CHECK_POINT, STEP

class c73248:
    name = '验证所有界面存在且可操作-c733248' # 测试用例名字

# 初始化方法
    def setup(self):
        STEP(1, '超级管理员登陆网站')
        driver = open_browser()
        mgr_login(driver)

    #清除方法
    def teardown(self):
        driver = get_global_webdriver()
        logout(driver)
        driver.quit()

    # 测试用例步骤
    def teststeps(self):
        # 获取webdriver对象 对应 已经登录好的浏览器
        driver = get_global_webdriver()
        STEP(2, '输入超级管理员的账号和正确的密码，点击登录')
        try:
            self.driver.find_element(By.CSS_SELECTOR, ".is-active > div:nth-child(1) > svg:nth-child(1)").click()
        except:
            print("左侧栏没有隐藏")
        got_list2 = []
        product_word2 = self.driver.find_element(By.XPATH,
                                                 "/html/body/div/div/div[1]/ul/div[1]/a/li/span").text
        got_list2.append(product_word2)
        apply_word2 = self.driver.find_element(By.CSS_SELECTOR,
                                               ".el-menu > div:nth-child(2) > a:nth-child(1) > li:nth-child(1) > span:nth-child(2)").text
        got_list2.append(apply_word2)
        product_manage_word2 = self.driver.find_element(By.CSS_SELECTOR,
                                                        ".el-menu > div:nth-child(3) > a:nth-child(1) > li:nth-child(1) > span:nth-child(2)").text
        got_list2.append(product_manage_word2)
        user_manage_word2 = self.driver.find_element(By.CSS_SELECTOR,
                                                     ".el-menu > div:nth-child(4) > a:nth-child(1) > li:nth-child(1) > span:nth-child(2)").text
        got_list2.append(user_manage_word2)

        expetced_word_list2 = ["产品列表", "申请记录", "产品管理", "用户管理"]
        CHECK_POINT("验证是否为期待文字列表", expetced_word_list2 == got_list2)

        STEP(3,"在产品列表，点击各个可弹出窗口、可编辑的页面，直到最底一层页面")
        STEP(4,"申请试用相关")
        # need-TODO
